package com.lanou.musicproject.base;

import android.app.Application;
import android.content.Context;
import android.os.Environment;

import java.io.File;

/**
 * Created by 王世美. on 2015/10/21.
 * 专属应用框架
 */
public class BaseApplication extends Application {
    public static Context context;
    private static BaseApplication sApp;
    public static boolean mIsSleepClockSetting = false;




    private static String rootPath = "/mymusic";
    public static String lrcPath = "/lrc";

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        sApp = BaseApplication.this;
        initPath();
    }

    public static Context getAppContext(){
        return context;
    }

    public static BaseApplication getInstance() {
        return sApp;
    }

    private void initPath() {
        String ROOT = "";
        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            ROOT = Environment.getExternalStorageDirectory().getPath();
        }
        rootPath = ROOT + rootPath;
        lrcPath = rootPath + lrcPath;
        File lrcFile = new File(lrcPath);
        if(lrcFile.exists()) {
            lrcFile.mkdirs();
        }
    }

}
